'use strict';

const Controller = require('egg').Controller;

class ControllerAddCourseController extends Controller {
    async controllerAddCourse() {
        const { ctx } = this;
        const data = {
            name: ctx.request.body.name,
            subject: ctx.request.body.subject,
            price: ctx.request.body.price,
            state: ctx.request.body.state,
            // date: ctx.request.body.date,
            username: ctx.request.body.username,
        };
        const res = await this.ctx.service.serviceAddCourse.postAddCourseData(data);
        if (res.code === 1) {
            ctx.status = 200;
            ctx.body = {
                data: "添加成功",
            };
        } else {
            ctx.status = 400;
            ctx.body = { message: res.message };
        }

    }
    async getCourseList() {
      const { ctx } = this;
    }
}

module.exports = ControllerAddCourseController;
